﻿#region << 文件说明 >>

/*----------------------------------------------------------------
 * 命名空间：Vampirewal.Core.Models.FlowEngine
 * 唯一标识：2093ed25-1b6b-4adc-96ee-022fa41a824b
 * 文件名：FlowTask
 *
 * 创建者：杨程
 * 电子邮箱：235160615@qq.com
 * 创建时间：2023/10/13 17:55:32
 * 版本：V1.0.0
 * 描述：
 *
 * ----------------------------------------------------------------
 * 修改人：
 * 时间：
 * 修改说明：
 *
 * 版本：V1.0.1
 *----------------------------------------------------------------*/

#endregion << 文件说明 >>

namespace Vampirewal.Core.Models.FlowEngine;

/// <summary>
/// 流程中每一步
/// </summary>
[SugarTable("Work_Task", tableDescription: "流程任务表")]
public class FlowTask : TopModel
{
    /// <summary>
    /// 主键
    /// </summary>
    [SugarColumn(IsPrimaryKey = true, Length = 50)]
    public string TaskId { get; set; }

    /// <summary>
    /// 工作流ID
    /// </summary>
    [SugarColumn(ColumnDescription = "工作流ID", Length = 50)]
    public string WorkId { get; set; }

    /// <summary>
    /// 流程节点ID
    /// </summary>
    [SugarColumn(ColumnDescription = "流程节点ID", Length = 50)]
    public string FlowUnitId { get; set; }

    /// <summary>
    /// 执行人Id
    /// </summary>
    [SugarColumn(ColumnDescription = "执行人Id", Length = 50, IsNullable = true)]
    public string ExcutorId { get; set; }

    /// <summary>
    /// 执行人
    /// </summary>
    [SugarColumn(ColumnDescription = "执行人", Length = 50, IsNullable = true)]
    public string Excutor { get; set; }



    /// <summary>
    /// 任务状态
    /// </summary>
    [SugarColumn(ColumnDescription = "任务状态", Length = 50, IsNullable = true)]
    public WorkStateType State { get; set; }

    /// <summary>
    /// 通知时间
    /// </summary>
    [SugarColumn(ColumnDescription = "通知时间", IsNullable = true)]
    public DateTime? NotifyTime { get; set; }

    /// <summary>
    /// 结束时间
    /// </summary>
    [SugarColumn(ColumnDescription = "结束时间", IsNullable = true)]
    public DateTime? FinishTime { get; set; }



    /// <summary>
    /// 设置结束
    /// </summary>
    public void SetFinish()
    {
        this.State = WorkStateType.Finished; 
        this.FinishTime= DateTime.Now;
    }
}